<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var arr=[1,2,3]
console.log(arr.includes(4));


let arr1 = [1, 2, 5];
let arr2 = [1, 3, 4, 2];
function compare(arr1, arr2) {
  return arr1.filter((v) => {
    return arr2.includes(v);
  });
}
console.log(compare(arr1, arr2)); // [1, 2] 找出相同的元素

</script>
</html>